import request from '@/utils/http'

export interface GetUserListResult {
  employeeCode: string
  firstName: string
  gender: string
  nationId: string
  phoneId?: string
  email?: string
  birthDay: any
  nation?: string
  hireDate: any
  state?: string
  dimissionDate: any
  title?: string
  education?: string
  oldAgeInsurance?: string
  address?: string
  jobTitleId: string
  jobTitle: string
  wxClubOpenId?: string
  id: string
}

export function CreateUser(data) {
  return request.request({
    url: '/api/v3.1/business/person-document',
    method: 'post',
    data
  })
}

export function GetUserList(data: Recordable) {
  return request.request<GetUserListResult[]>({
    url: '/api/v3.1/business/person-document/person-doc',
    method: 'post',
    data
  })
}

export function deleteYuanGong(Id) {
  return request.request({
    url: '/api/v3.1/business/person-document?personDocumentId=' + Id,
    method: 'delete'
  })
}

export function UpdateUser(id, data) {
  return request.request({
    url: '/api/v3.1/business/person-document?personDocumentId=' + id,
    method: 'put',
    data
  })
}

/** 根据用户id获取微信公众号二维码的Ticket */
export function GetTicket(data) {
  return request.request({
    url: '/api/system-alarm/system-alarm-info/wx-club-qRTicket?Scene_Type=1&UserID=' + data.UserID,
    method: 'get'
  })
}

/** 解除绑定 */
export function deleteTicket(UserID) {
  return request.request({
    url: '/api/v3.1/business/person-document/person-wx-club-open-id/' + UserID,
    method: 'put'
  })
}
